import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Button-FlatButton-扁平按钮',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Button-FlatButton-扁平按钮'),
        ),
          body: Column(
            children: [
              FlatButton.icon(onPressed: (){print('FlatButton.icon');},
                  icon: Icon(Icons.print,size: 28,), label: Text('anniew',style: TextStyle(fontSize: 28),)),
              
              FlatButton(
                  child: Text('Success',style: TextStyle(fontSize: 26),
                  ),
                //背景色
                color: Colors.green,
                //亮度
                colorBrightness: Brightness.dark,
                //失效背景色
                disabledColor: Colors.grey,
                //失效文本色
                disabledTextColor: Colors.grey,
                //文本色
                textColor: Colors.white,
                //主题
                textTheme: ButtonTextTheme.normal,
                //墨汁飞溅颜色
                splashColor: Colors.red,
                //抗锯齿
                clipBehavior: Clip.antiAlias,
                //内边距
                padding: EdgeInsets.only(
                  bottom: 5,
                  top: 5,
                  left: 20,
                  right: 20
                ),
                //边框样式
                // shape: Border.all(
                //   width: 2,
                //   color: Colors.white,
                //   // style: BorderStyle.solid
                // ),
                shape: RoundedRectangleBorder(
                  side: BorderSide(
                    width: 2,
                    color: Colors.white,
                    style: BorderStyle.solid
                  ),
                  borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(10),
                    topRight: Radius.circular(10),
                    bottomLeft: Radius.circular(10),
                    bottomRight: Radius.circular(10),
                  ),
                ),
                onPressed: (){
                  print('Success');
                },
              ),
              FlatButton(
                child: Text('Fail',style: TextStyle(fontSize: 26),
                ),
                //背景色
                color: Colors.red,
                //亮度
                colorBrightness: Brightness.dark,
                //失效背景色
                disabledColor: Colors.grey,
                //失效文本色
                disabledTextColor: Colors.grey,
                //文本色
                textColor: Colors.white,
                //主题
                textTheme: ButtonTextTheme.normal,
                //墨汁飞溅颜色
                splashColor: Colors.blue,
                //抗锯齿
                clipBehavior: Clip.antiAlias,
                //内边距
                padding: EdgeInsets.only(
                    bottom: 5,
                    top: 5,
                    left: 20,
                    right: 20
                ),
                //边框样式
                // shape: Border.all(
                //   width: 2,
                //   color: Colors.white,
                //   // style: BorderStyle.solid
                // ),
                shape: RoundedRectangleBorder(
                  side: BorderSide(
                      width: 2,
                      color: Colors.white,
                      style: BorderStyle.solid
                  ),
                  borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(10),
                    topRight: Radius.circular(10),
                    bottomLeft: Radius.circular(10),
                    bottomRight: Radius.circular(10),
                  ),
                ),
                onPressed: (){
                  print('Fail');
                },
              ),
            ],
          )
      ),
    );
  }
}
